<template>
  <div class="item">
    <img
      src="https://yanxuan-item.nosdn.127.net/84a59ff9c58a77032564e61f716846d6.jpg"
      alt=""
    />
    <p class="name">{{ obj.name }} <span class="tag">【赠品】10优惠券</span></p>
    <p class="spec">
      {{ spec }}
    </p>
    <p class="price">{{ obj.price }}</p>
    <p class="count">x{{ obj.count }}</p>
    <p class="sub-total">{{ obj.price * obj.count }}</p>
  </div>
</template>

<script>
export default {
  props: {
    obj: {
      type: Object,
      required: true,
    },
  },
  computed: {
    spec() {
      if (this.obj.spec.size) {
        return this.obj.spec.size + "/" + this.obj.spec.color;
      }
      if (this.obj.spec.sum) {
        return this.obj.spec.color + "/" + this.obj.spec.sum;
      }
      if (this.obj.spec.color) {
        return this.obj.spec.color;
      }
    },
  },
};
</script>

<style>
</style>